<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>psychsim.probability.Distribution</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="psychsim.world.World-class.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://pynadath.net:81/projects/psychsim">PsychSim</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="psychsim-module.html">Package&nbsp;psychsim</a> ::
        <a href="psychsim.probability-module.html">Module&nbsp;probability</a> ::
        Class&nbsp;Distribution
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="psychsim.probability.Distribution-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Distribution</h1><p class="nomargin-top"><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_psychsim_3" name="uml_class_diagram_for_psychsim_3">
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#epsilon" title="psychsim.probability.Distribution.epsilon" alt="" coords="168,369,368,388"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__init__" title="x.__init__(...) initializes x; see help(type(x)) for signature" alt="" coords="168,391,368,409"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__getitem__" title="x[y]" alt="" coords="168,409,368,428"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__setitem__" title="x[i]=y" alt="" coords="168,428,368,447"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__delitem__" title="del x[y]" alt="" coords="168,447,368,465"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#clear" title="Remove all items from D." alt="" coords="168,465,368,484"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#replace" title="Replaces on element in the sample space with another." alt="" coords="168,484,368,503"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#domain" title="Returns: &#160;the sample space of this probability distribution" alt="" coords="168,503,368,521"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#normalize" title="Normalizes the distribution so that the sum of values = 1" alt="" coords="168,521,368,540"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#expectation" title="Returns: &#160;the expected value of this distribution" alt="" coords="168,540,368,559"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#sample" title="Returns: &#160;an element from this domain, with a sample probability given by this &#160;distribution" alt="" coords="168,559,368,577"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#set" title="Reduce distribution to be 100% for the given element" alt="" coords="168,577,368,596"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#select" title="Reduce distribution to a single element, sampled according to the given &#160;distribution" alt="" coords="168,596,368,615"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__add__" title="psychsim.probability.Distribution.__add__" alt="" coords="168,615,368,633"/>
<area shape="rect" id="node4" href="psychsim.probability.Distribution-class.html#__copy__" title="psychsim.probability.Distribution.__copy__" alt="" coords="168,652,368,671"/>
<area shape="rect" id="node1" href="psychsim.probability.Distribution-class.html" title="A probability distribution" alt="" coords="156,345,380,677"/>
<area shape="rect" id="node3" href="psychsim.pwl.TreeDistribution-class.html" title="A class representing a Distribution over KeyedTree instances" alt="" coords="5,697,157,735"/>
<area shape="rect" id="node4" href="psychsim.pwl.MatrixDistribution-class.html" title="psychsim.pwl.MatrixDistribution" alt="" coords="187,697,349,735"/>
<area shape="rect" id="node5" href="psychsim.pwl.VectorDistribution-class.html" title="A class representing a Distribution over KeyedVector instances" alt="" coords="379,697,544,735"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="cmp(x,y)" alt="" coords="208,39,328,57"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="dict.__contains__" alt="" coords="208,57,328,76"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x==y" alt="" coords="208,76,328,95"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x&gt;=y" alt="" coords="208,95,328,113"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x.__getattribute__(&#39;name&#39;) &lt;==&gt; x.name" alt="" coords="208,113,328,132"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x&gt;y" alt="" coords="208,132,328,151"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="iter(x)" alt="" coords="208,151,328,169"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x&lt;=y" alt="" coords="208,169,328,188"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="len(x)" alt="" coords="208,188,328,207"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x&lt;y" alt="" coords="208,207,328,225"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="x!=y" alt="" coords="208,225,328,244"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="dict.__new__" alt="" coords="208,244,328,263"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="repr(x)" alt="" coords="208,263,328,281"/>
<area shape="rect" id="node5" href="javascript:void(0);" title="dict.viewvalues" alt="" coords="208,300,328,319"/>
<area shape="rect" id="node2" href="javascript:void(0);" title="dict() &#45;&gt; new empty dictionary dict(mapping) &#45;&gt; new dictionary initialized from a mapping object&#39;s (key, value) pairs dict(iterable) &#45;&gt; new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) &#45;&gt; new dictionary initialized with the name=value pairs in the keyword argument list." alt="" coords="196,6,340,325"/>
</map>
  <img src="uml_class_diagram_for_psychsim_3.gif" alt='' usemap="#uml_class_diagram_for_psychsim_3" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<p>A probability distribution</p>
  <ul>
    <li>
      <code>dist.<a 
      href="psychsim.probability.Distribution-class.html#domain" 
      class="link">domain</a>()</code>:   Returns the domain of possible 
      values
    </li>
    <li>
      <code>dist.items()</code>:  Returns the list of all (value,prob) 
      pairs
    </li>
    <li>
      <code>dist[value]</code>:     Returns the probability of the given 
      value
    </li>
    <li>
      <code>dist[value] = x</code>: Sets the probability of the given value
      to x
    </li>
  </ul>
  <p>The possible domain values are any objects</p>

<hr />
<div class="fields">      <p><strong>Warning:</strong>
        If you make the domain values mutable types, try not to change the 
        values while they are inside the distribution.  If you must change 
        a domain value, it is better to first delete the old value, change 
        it, and then re-insert it.
      </p>
</div><!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><pre class="literalblock">
new empty dictionary

</pre></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">args</span>=<span class="summary-sig-default">None</span>)</span><br />
      x.__init__(...) initializes x; see help(type(x)) for signature</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__getitem__" class="summary-sig-name">__getitem__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>)</span><br />
      x[y]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__getitem__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__setitem__" class="summary-sig-name">__setitem__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>,
        <span class="summary-sig-arg">value</span>)</span><br />
      x[i]=y</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__setitem__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__delitem__" class="summary-sig-name">__delitem__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>)</span><br />
      del x[y]</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__delitem__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">None</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#clear" class="summary-sig-name">clear</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Remove all items from D.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.clear">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#replace" class="summary-sig-name">replace</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">old</span>,
        <span class="summary-sig-arg">new</span>)</span><br />
      Replaces on element in the sample space with another.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.replace">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><code>list</code></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#domain" class="summary-sig-name">domain</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      the sample space of this probability distribution</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.domain">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#normalize" class="summary-sig-name">normalize</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Normalizes the distribution so that the sum of values = 1</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.normalize">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">float</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#expectation" class="summary-sig-name">expectation</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      the expected value of this distribution</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.expectation">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#sample" class="summary-sig-name">sample</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      an element from this domain, with a sample probability given by this 
      distribution</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.sample">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#set" class="summary-sig-name">set</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>)</span><br />
      Reduce distribution to be 100% for the given element</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.set">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#select" class="summary-sig-name">select</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Reduce distribution to a single element, sampled according to the 
      given distribution</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.select">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__add__"></a><span class="summary-sig-name">__add__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__add__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__sub__"></a><span class="summary-sig-name">__sub__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__sub__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__xml__" class="summary-sig-name">__xml__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Returns:
      An XML Document object representing this distribution</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__xml__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="element2xml"></a><span class="summary-sig-name">element2xml</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">value</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.element2xml">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#parse" class="summary-sig-name">parse</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>)</span><br />
      Extracts the distribution from the given XML element</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.parse">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="xml2element"></a><span class="summary-sig-name">xml2element</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">node</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.xml2element">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      str(x)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__str__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.probability.Distribution-class.html#__hash__" class="summary-sig-name">__hash__</a>(<span class="summary-sig-arg">self</span>)</span><br />
      hash(x)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__hash__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__copy__"></a><span class="summary-sig-name">__copy__</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__copy__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>dict</code></b>:
      <code>__cmp__</code>,
      <code>__contains__</code>,
      <code>__eq__</code>,
      <code>__ge__</code>,
      <code>__getattribute__</code>,
      <code>__gt__</code>,
      <code>__iter__</code>,
      <code>__le__</code>,
      <code>__len__</code>,
      <code>__lt__</code>,
      <code>__ne__</code>,
      <code>__new__</code>,
      <code>__repr__</code>,
      <code>__sizeof__</code>,
      <code>copy</code>,
      <code>fromkeys</code>,
      <code>get</code>,
      <code>has_key</code>,
      <code>items</code>,
      <code>iteritems</code>,
      <code>iterkeys</code>,
      <code>itervalues</code>,
      <code>keys</code>,
      <code>pop</code>,
      <code>popitem</code>,
      <code>setdefault</code>,
      <code>update</code>,
      <code>values</code>,
      <code>viewitems</code>,
      <code>viewkeys</code>,
      <code>viewvalues</code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__setattr__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="epsilon"></a><span class="summary-name">epsilon</span> = <code title="1e-08">1e-08</code>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">args</span>=<span class="sig-default">None</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
  <dl class="fields">
    <dt>Returns: <pre class="literalblock">
new empty dictionary

</pre></dt>
    <dt>Overrides:
        object.__init__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__getitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__getitem__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">element</span>)</span>
    <br /><em class="fname">(Indexing operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__getitem__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>x[y]</p>
  <dl class="fields">
    <dt>Overrides:
        dict.__getitem__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__setitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__setitem__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">element</span>,
        <span class="sig-arg">value</span>)</span>
    <br /><em class="fname">(Index assignment operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__setitem__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>x[i]=y</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>element</code></strong> - the domain element</li>
        <li><strong class="pname"><code>value</code></strong> (float) - the probability to associate with the given key</li>
    </ul></dd>
    <dt>Overrides:
        dict.__setitem__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__delitem__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__delitem__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">element</span>)</span>
    <br /><em class="fname">(Index deletion operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__delitem__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>del x[y]</p>
  <dl class="fields">
    <dt>Overrides:
        dict.__delitem__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="clear"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">clear</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.clear">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Remove all items from D.</p>
  <dl class="fields">
    <dt>Returns: None</dt>
    <dt>Overrides:
        dict.clear
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="replace"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">replace</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">old</span>,
        <span class="sig-arg">new</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.replace">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Replaces on element in the sample space with another.  Raises an 
  exception if the original element does not exist, and an exception if the
  new element already exists (i.e., does not do a merge)</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="domain"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">domain</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.domain">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns: <code>list</code></dt>
        <dd>the sample space of this probability distribution</dd>
  </dl>
</td></tr></table>
</div>
<a name="normalize"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">normalize</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.normalize">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Normalizes the distribution so that the sum of values = 1</p>
  <dl class="fields">
  </dl>
<div class="fields">      <p><strong>Note:</strong>
        Not sure if this is really necessary
      </p>
</div></td></tr></table>
</div>
<a name="expectation"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">expectation</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.expectation">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns: float</dt>
        <dd>the expected value of this distribution</dd>
  </dl>
<div class="fields">      <p><strong>Warning:</strong>
        As a side effect, the distribution will be normalized
      </p>
</div></td></tr></table>
</div>
<a name="sample"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">sample</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.sample">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>an element from this domain, with a sample probability given by 
          this distribution</dd>
  </dl>
</td></tr></table>
</div>
<a name="set"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">set</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">element</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.set">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Reduce distribution to be 100% for the given element</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>element</code></strong> - the element that will be the only one with nonzero probability</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="select"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">select</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.select">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Reduce distribution to a single element, sampled according to the 
  given distribution</p>
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>the selected element</dd>
  </dl>
</td></tr></table>
</div>
<a name="__xml__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__xml__</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__xml__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>An XML Document object representing this distribution</dd>
  </dl>
</td></tr></table>
</div>
<a name="parse"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">parse</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">element</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.parse">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Extracts the distribution from the given XML element</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>element</code></strong> (Element) - The XML Element object specifying the distribution</li>
    </ul></dd>
    <dt>Returns:</dt>
        <dd>This <a href="psychsim.probability.Distribution-class.html" 
          class="link">Distribution</a> object</dd>
  </dl>
</td></tr></table>
</div>
<a name="__str__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">self</span>)</span>
    <br /><em class="fname">(Informal representation operator)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__str__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>str(x)</p>
  <dl class="fields">
    <dt>Overrides:
        object.__str__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="__hash__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__hash__</span>(<span class="sig-arg">self</span>)</span>
    <br /><em class="fname">(Hashing function)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.probability-pysrc.html#Distribution.__hash__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>hash(x)</p>
  <dl class="fields">
    <dt>Overrides:
        object.__hash__
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="psychsim.world.World-class.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://pynadath.net:81/projects/psychsim">PsychSim</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Oct 24 21:38:09 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
